package com.yc.blog.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.yc.blog.bean.BlogType;
import com.yc.blog.biz.IBlogTypeBiz;
import com.yc.blog.util.StringUtil;
import com.yc.blog.dao.IBlogTypeDao;
import com.yc.blog.dao.impl.BlogTypeDaoImpl;

public class BlogTypeBizImpl implements IBlogTypeBiz {

	@Override
	public int add(String tname) {
		if(StringUtil.chekNUll(tname)){
			return -1;
		}
		IBlogTypeDao typedao = new BlogTypeDaoImpl();
		return typedao.add(tname);
	}

	@Override
	public int update(String tid, String status) {
		if(StringUtil.chekNUll(tid,status)){
			return -1;
		}
		IBlogTypeDao typedao = new BlogTypeDaoImpl();
		return typedao.update(tid,status);
	}

	@Override
	public Map<String, Object> findByFirst(int page, int rows) {
		
		IBlogTypeDao typedao = new BlogTypeDaoImpl();
		Map<String,Object> result = new HashMap<String, Object>();
		result.put("total", typedao.total());
		result.put("rows", typedao.findByPage(page, rows));
		return result;
	}

	@Override
	public List<BlogType> findByPage(int page, int rows) {
		IBlogTypeDao typedao = new BlogTypeDaoImpl();
		return typedao.findByPage(page, rows);
	}

	@Override
	public List<BlogType> findAll() {
		IBlogTypeDao typedao = new BlogTypeDaoImpl();
		return typedao.findAll();
	}

}
